home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Utilities / Interfaces / BArray.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  1.9 KB  |  87 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BArray.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Craig Carper
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     3/15/96    CC        1331422: Added ODAEGetByteArray function.
  13.  
  14.     To Do:
  15. */
  16.  
  17. /*
  18.     File:        BArray.h
  19.  
  20.     Contains:    ByteArray collection
  21.  
  22.     Owned by:    Vincent Lo
  23.  
  24.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  25.  
  26.     
  27. */
  28.  
  29. #ifndef _BARRAY_
  30. #define _BARRAY_
  31.  
  32. #ifndef _ODTYPES_
  33. #include <ODTypes.h>
  34. #endif
  35.  
  36. #ifndef __APPLEEVENTS__
  37. #include <AppleEvents.h>
  38. #endif
  39.  
  40. /* DisposeByteArrayStruct is a macro instead of a function so it can take a different
  41.    parameter type than DisposeByteArray(), and still set the disposed pointer field
  42.    of the structure to null.
  43.    DisposeByteArray() must never be called on a ByteArray structure; DisposeByteArray()
  44.    disposes the structure which is usually a distaster.
  45. */
  46.  
  47. #define    DisposeByteArrayStruct(byteArray)        \
  48.     do{                                            \
  49.         if (byteArray._buffer != kODNULL) {        \
  50.             ODDisposePtr(byteArray._buffer);    \
  51.             byteArray._buffer = kODNULL;        \
  52.         }                                        \
  53.         byteArray._length = 0;                    \
  54.         byteArray._maximum = 0;                    \
  55.     }while(0)
  56.  
  57.  
  58. #ifdef _OD_IMPL_SHARE_UTILS_
  59. #pragma import on
  60. #endif
  61.  
  62. extern "C" {
  63.     ODByteArray*    CreateByteArray(void* buffer, ODULong size);
  64.     ODByteArray        CreateByteArrayStruct(void* buffer, ODULong size);
  65.  
  66.     ODByteArray*    CreateEmptyByteArray(ODULong maximum);
  67.     ODByteArray        CreateEmptyByteArrayStruct(ODULong maximum);
  68.  
  69.     void UseByteArray(ODByteArray* ba, void* buffer, ODULong size);
  70.  
  71.     ODByteArray*    CopyByteArray(ODByteArray* fromBA);
  72.     ODByteArray        CopyByteArrayStruct(ODByteArray* fromBA);
  73.  
  74.     void            DisposeByteArray(ODByteArray* array);
  75.  
  76.     ODBoolean        AreByteArraysEqual(ODByteArray* ba1, ODByteArray* ba2);
  77.  
  78.     ODByteArray*    ODAEGetByteArray(const AppleEvent *theAppleEvent,
  79.                                         AEKeyword theAEKeyword,
  80.                                         DescType desiredType);
  81. }
  82.  
  83. #ifdef _OD_IMPL_SHARE_UTILS_
  84. #pragma import off
  85. #endif
  86.  
  87. #endif     // _BARRAY_